package com.lyj.cloud.business;

import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

@Component
public class DefaultMessage {
	
	private int i = 0;

	// 监听 binding 为 Processor.INPUT 的消息
    @StreamListener(Processor.INPUT)
    public void input(Message<String> message) {
    	if(i <= 2){
    		i++;
    		throw new RuntimeException();
    	}
        System.out.println("SpringCLoud监听收到：" + i + message.getPayload());
    }

}
